package com.xh.bussiness.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xh.bussiness.system.bean.dto.SystemParamBean;
import com.xh.bussiness.system.bean.request.SystemParamRequest;
import com.xh.bussiness.system.model.SystemParam;
import com.xh.bussiness.system.dao.SystemParamMapper;
import com.xh.bussiness.system.service.ISystemParamService;
import com.xh.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.xh.core.bean.XhPage;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author daiwei
 * @since 2018-09-28
 */
@Service
public class SystemParamServiceImpl extends BaseServiceImpl<SystemParamMapper, SystemParam> implements ISystemParamService {
    @Override
    public XhPage querySystemParamPage(XhPage page, SystemParamRequest bean) {
        QueryWrapper qw=new QueryWrapper<SystemParam>();
        //拼装条件
        if(bean.getIds()!=null&&bean.getIds().length>0){
            qw.in("id",bean.getIds());
        }

        return (XhPage) this.dao.selectPage(page,qw);
    }

    @Override
    public SystemParamBean queryByCode(String code) {
        QueryWrapper qw=new QueryWrapper<SystemParam>();
        //拼装条件
        qw.in("code", code);
        return this.selectOne(qw, SystemParamBean.class);
    }
}
